<?php
/**
 * This file is part of webman.
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the MIT-LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @author    walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link      http://www.workerman.net/
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 */

use support\Request;
use Webman\Route;

Route::any('/test', function (Request $request) {
    return response('test');
});

//控制器
Route::group('/index', function() {
    Route::any('/login', [app\controller\LoginController::class], 'login');
});

//API接口
Route::group('/api', function() {
    Route::any('/world', [app\api\WorldController::class, 'getTree']);
    Route::any('/resource', [app\api\WorldController::class, 'getResource']);
    Route::any('/get-resource', [app\api\getData::class, 'getResource']);
    Route::any('/login',[app\api\Login::class, 'login']);   //登陆api
    Route::any('/register',[app\api\Login::class, 'register']);   //注册api
});

//主页信息访问
Route::group('/index', function() {
    Route::any('/index', [app\controller\GameController::class, 'index']);
})->middleware([app\middleware\AuthMiddleware::class]);


